package view;

import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.LayoutStyle;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.WindowConstants;

import model.Employee;
import view.customer.CustomerMainPanel;
import view.employee.EmployeeMainPanel;
import view.invoice.InvoiceAddPanel;
import view.invoice.InvoiceViewPanel;
import view.product.ProductMainPanel;
import view.product.ProductSubLaptop;
import view.product.ProductSubMobileTablet;
import view.product.ProductSupplierPanel;
import view.statistic.StatisticPanelDay;
import view.statistic.StatisticPanelMonth;
import view.statistic.StatisticPanelYear;
import view.tabbedpane.CustomerTabbedPane;
import view.tabbedpane.EmployeeTabbedPane;
import view.tabbedpane.InvoiceTabbedPane;
import view.tabbedpane.ProductTabbedPane;
import view.tabbedpane.StartisticTabbedPane;
import controller.home.ChangePassController;
import controller.home.CustomerController;
import controller.home.EmployeeController;
import controller.home.HomeWindowsController;
import controller.home.InvoiceController;
import controller.home.LogoutController;
import controller.home.ProductController;
import controller.home.StatisticController;
import date.MyDate;

public class Home extends JFrame {
	private static final long serialVersionUID = 1L;

	private JButton btnMainChangepass;
	private JButton btnMainCustomer;
	private static JButton btnMainEmployee;
	private JButton btnMainInvoice;
	private JButton btnMainLogout;
	private JButton btnMainProducts;
	private JButton btnMainStatistic;
	private JLabel lblMainDate;
	private static JLabel lblMainUser;
	private JLabel lblMainVersion;

	private JPanel pnMainLogininfor;
	private ImagePanel pnMainTitle;
	private JPanel pnMainDisplay;
	private JPanel pnMainMenu;

	private CustomerMainPanel pnCus;
	private EmployeeMainPanel pnEm;
	private ProductMainPanel pnProd;
	private ProductSupplierPanel pnSupp;
	private ProductSubLaptop pnSubLaptop;
	private ProductSubMobileTablet pnSubMobileTablet;

	private StatisticPanelDay pnStaDay;
	private StatisticPanelMonth pnStaMonth;
	private StatisticPanelYear pnStaYear;

	private InvoiceAddPanel pnInAdd;
	private InvoiceViewPanel pnInView;

	private ProductTabbedPane pnProdTabbed;
	private InvoiceTabbedPane pnInvoiceTabbed;

	private EmployeeTabbedPane pnEmployeeTabbed;
	private CustomerTabbedPane pnCustomerTabbed;
	private StartisticTabbedPane pnStatisticTabbed;

	private static Employee emp;

	public static void setEmployee(Employee e) {
		emp = e;
	}

	public static Employee getEmployee() {
		return emp;
	}

	private JPanel pnCurrentDisplay;

	private static Home instance;

	public static Home getInstance() {
		if (instance == null) {
			return instance = new Home();
		}
		return instance;
	}

	private Home() {
		initComponents();
		pnMainDisplay.setLayout(null);
		pnCurrentDisplay = pnProdTabbed;
		pnMainDisplay.add(pnCurrentDisplay);
		pnCurrentDisplay.setBounds(0, 0, 911, 508);

		controller();
		setResizable(false);
		setTitle("Home");
		pnMainTitle.src = "icon/background.png";
		pnMainTitle.repaint();
		pnProdTabbed.getObserverable().addObserver(
				pnInvoiceTabbed.getObserver());
		pnInvoiceTabbed.getObservable().addObserver(pnProdTabbed.getObserver());
		pnInvoiceTabbed.getObservable().addObserver(pnStaDay.getObserver());

	}

	private void newCom() {
		pnCus = new CustomerMainPanel();
		pnEm = new EmployeeMainPanel();
		pnProd = new ProductMainPanel();
		pnSupp = new ProductSupplierPanel();
		pnSubLaptop = new ProductSubLaptop();
		pnSubMobileTablet = new ProductSubMobileTablet();
		pnInAdd = new InvoiceAddPanel();
		pnInView = new InvoiceViewPanel();
		pnMainTitle = new ImagePanel();

		// pnTabbed = new Prod_TabbedPane();
		pnProdTabbed = new ProductTabbedPane();
		pnEmployeeTabbed = new EmployeeTabbedPane();
		pnCustomerTabbed = new CustomerTabbedPane();
		pnInvoiceTabbed = new InvoiceTabbedPane();
		pnStatisticTabbed = new StartisticTabbedPane();

		pnStaDay = new StatisticPanelDay();
		pnStaMonth = new StatisticPanelMonth();
		pnStaYear = new StatisticPanelYear();

	}

	public JButton getBtnMainChangepass() {
		return btnMainChangepass;
	}

	public void setBtnMainChangepass(JButton btnMainChangepass) {
		this.btnMainChangepass = btnMainChangepass;
	}

	public JButton getBtnMainCustomer() {
		return btnMainCustomer;
	}

	public void setBtnMainCustomer(JButton btnMainCustomer) {
		this.btnMainCustomer = btnMainCustomer;
	}

	public static JButton getBtnMainEmployee() {
		return btnMainEmployee;
	}

	public static void setBtnMainEmployee(JButton btn) {
		btnMainEmployee = btn;
	}

	public JButton getBtnMainInvoice() {
		return btnMainInvoice;
	}

	public void setBtnMainInvoice(JButton btnMainInvoice) {
		this.btnMainInvoice = btnMainInvoice;
	}

	public JButton getBtnMainLogout() {
		return btnMainLogout;
	}

	public void setBtnMainLogout(JButton btnMainLogout) {
		this.btnMainLogout = btnMainLogout;
	}

	public JButton getBtnMainProducts() {
		return btnMainProducts;
	}

	public void setBtnMainProducts(JButton btnMainProducts) {
		this.btnMainProducts = btnMainProducts;
	}

	public JButton getBtnMainStatistic() {
		return btnMainStatistic;
	}

	public void setBtnMainStatistic(JButton btnMainStatistic) {
		this.btnMainStatistic = btnMainStatistic;
	}

	public JLabel getLblMainDate() {
		return lblMainDate;
	}

	public void setLblMainDate(JLabel lblMainDate) {
		this.lblMainDate = lblMainDate;
	}

	public static JLabel getLblMainUser() {
		return lblMainUser;
	}

	public static void setLblMainUser(JLabel lbl) {
		lblMainUser = lbl;
	}

	public JLabel getLblMainVersion() {
		return lblMainVersion;
	}

	public void setLblMainVersion(JLabel lblMainVersion) {
		this.lblMainVersion = lblMainVersion;
	}

	public JPanel getPnMainLogininfor() {
		return pnMainLogininfor;
	}

	public void setPnMainLogininfor(JPanel pnMainLogininfor) {
		this.pnMainLogininfor = pnMainLogininfor;
	}

	public JPanel getPnMainTitle() {
		return pnMainTitle;
	}

	// public void setPnMainTitle(JPanel pnMainTitle) {
	// this.pnMainTitle = pnMainTitle;
	// }

	public JPanel getPnMainDisplay() {
		return pnMainDisplay;
	}

	public void setPnMainTitle(ImagePanel pnMainTitle) {
		this.pnMainTitle = pnMainTitle;
	}

	public void setPnMainDisplay(JPanel pnMainDisplay) {
		this.pnMainDisplay = pnMainDisplay;
	}

	public JPanel getPnMainMenu() {
		return pnMainMenu;
	}

	public void setPnMainMenu(JPanel pnMainMenu) {
		this.pnMainMenu = pnMainMenu;
	}

	public CustomerMainPanel getPnCus() {
		return pnCus;
	}

	public void setPnCus(CustomerMainPanel pnCus) {
		this.pnCus = pnCus;
	}

	public EmployeeMainPanel getPnEm() {
		return pnEm;
	}

	public void setPnEm(EmployeeMainPanel pnEm) {
		this.pnEm = pnEm;
	}

	public ProductMainPanel getPnProd() {
		return pnProd;
	}

	public void setPnProd(ProductMainPanel pnProd) {
		this.pnProd = pnProd;
	}

	public ProductSupplierPanel getPnSupp() {
		return pnSupp;
	}

	public void setPnSupp(ProductSupplierPanel pnSupp) {
		this.pnSupp = pnSupp;
	}

	public ProductSubLaptop getPnSubLaptop() {
		return pnSubLaptop;
	}

	public void setPnSubLaptop(ProductSubLaptop pnSubLaptop) {
		this.pnSubLaptop = pnSubLaptop;
	}

	public ProductSubMobileTablet getPnSubMobileTablet() {
		return pnSubMobileTablet;
	}

	public void setPnSubMobileTablet(ProductSubMobileTablet pnSubMobileTablet) {
		this.pnSubMobileTablet = pnSubMobileTablet;
	}

	public StatisticPanelDay getPnStaDay() {
		return pnStaDay;
	}

	public void setPnStaDay(StatisticPanelDay pnStaDay) {
		this.pnStaDay = pnStaDay;
	}

	public StatisticPanelMonth getPnStaMonth() {
		return pnStaMonth;
	}

	public void setPnStaMonth(StatisticPanelMonth pnStaMonth) {
		this.pnStaMonth = pnStaMonth;
	}

	public StatisticPanelYear getPnStaYear() {
		return pnStaYear;
	}

	public void setPnStaYear(StatisticPanelYear pnStaYear) {
		this.pnStaYear = pnStaYear;
	}

	public InvoiceAddPanel getPnInAdd() {
		return pnInAdd;
	}

	public void setPnInAdd(InvoiceAddPanel pnInAdd) {
		this.pnInAdd = pnInAdd;
	}

	public InvoiceViewPanel getPnInView() {
		return pnInView;
	}

	public void setPnInView(InvoiceViewPanel pnInView) {
		this.pnInView = pnInView;
	}

	public ProductTabbedPane getPnProdTabbed() {
		return pnProdTabbed;
	}

	public void setPnProdTabbed(ProductTabbedPane pnProdTabbed) {
		this.pnProdTabbed = pnProdTabbed;
	}

	public InvoiceTabbedPane getPnInvoiceTabbed() {
		return pnInvoiceTabbed;
	}

	public void setPnInvoiceTabbed(InvoiceTabbedPane pnInvoiceTabbed) {
		this.pnInvoiceTabbed = pnInvoiceTabbed;
	}

	public EmployeeTabbedPane getPnEmployeeTabbed() {
		return pnEmployeeTabbed;
	}

	public void setPnEmployeeTabbed(EmployeeTabbedPane pnEmployeeTabbed) {
		this.pnEmployeeTabbed = pnEmployeeTabbed;
	}

	public CustomerTabbedPane getPnCustomerTabbed() {
		return pnCustomerTabbed;
	}

	public void setPnCustomerTabbed(CustomerTabbedPane pnCustomerTabbed) {
		this.pnCustomerTabbed = pnCustomerTabbed;
	}

	public StartisticTabbedPane getPnStatisticTabbed() {
		return pnStatisticTabbed;
	}

	public void setPnStatisticTabbed(StartisticTabbedPane pnStatisticTabbed) {
		this.pnStatisticTabbed = pnStatisticTabbed;
	}

	public JPanel getPnCurrentDisplay() {
		return pnCurrentDisplay;
	}

	public void setPnCurrentDisplay(JPanel pnCurrentDisplay) {
		this.pnCurrentDisplay = pnCurrentDisplay;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public static void setInstance(Home instance) {
		Home.instance = instance;
	}

	private void controller() {

		btnMainEmployee.addActionListener(new EmployeeController(this));
		btnMainCustomer.addActionListener(new CustomerController(this));
		btnMainProducts.addActionListener(new ProductController(this));
		btnMainInvoice.addActionListener(new InvoiceController(this));
		btnMainStatistic.addActionListener(new StatisticController(this));
		btnMainLogout.addActionListener(new LogoutController(this));
		btnMainChangepass.addActionListener(new ChangePassController());
		this.addWindowListener(new HomeWindowsController(this));
	}

	public ProductTabbedPane getPn_prod_main() {
		return pnProdTabbed;
	}

	public void setPn_prod_main(ProductTabbedPane pn_prod_main) {
		this.pnProdTabbed = pn_prod_main;
	}

	public JPanel getPn_current_display() {
		return pnCurrentDisplay;
	}

	public void setPn_current_display(JPanel pn_current_display) {
		this.pnCurrentDisplay = pn_current_display;
	}

	private void initComponents() {
		newCom();
		pnMainTitle = new ImagePanel();
		pnMainMenu = new JPanel();
		btnMainEmployee = new JButton();
		btnMainCustomer = new JButton();
		btnMainProducts = new JButton();
		btnMainInvoice = new JButton();
		btnMainStatistic = new JButton();
		lblMainVersion = new JLabel();
		pnMainDisplay = new JPanel();
		pnMainLogininfor = new JPanel();
		btnMainChangepass = new JButton();
		lblMainUser = new JLabel();
		btnMainLogout = new JButton();
		lblMainDate = new JLabel();

		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		setResizable(false);

		pnMainTitle.setBackground(new java.awt.Color(255, 255, 255));
		// pnMainTitle.getGraphics().drawImage(new
		// ImageIcon("icon/background.png").getImage(), 0, 0,
		// pnMainTitle.getWidth(), pnMainTitle.getHeight(), null);
		// pnMainTitle.repaint();
		GroupLayout pn_main_titleLayout = new GroupLayout(pnMainTitle);
		pnMainTitle.setLayout(pn_main_titleLayout);
		pn_main_titleLayout.setHorizontalGroup(pn_main_titleLayout
				.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0,
						903, Short.MAX_VALUE));
		pn_main_titleLayout.setVerticalGroup(pn_main_titleLayout
				.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0,
						0, Short.MAX_VALUE));

		pnMainMenu.setBackground(new java.awt.Color(255, 255, 255));

		btnMainEmployee.setFont(new java.awt.Font("Calibri", 1, 18));
		btnMainEmployee.setIcon(new ImageIcon("icon/employee.png"));
		btnMainEmployee.setText("Employee");
		btnMainEmployee.setFocusable(false);
		btnMainEmployee.setHorizontalTextPosition(SwingConstants.RIGHT);
		btnMainEmployee.setIconTextGap(-5);
		btnMainEmployee.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_main_employeeActionPerformed(evt);
			}
		});

		btnMainCustomer.setFont(new java.awt.Font("Calibri", 1, 18));
		btnMainCustomer.setIcon(new ImageIcon("icon/customers.png"));
		btnMainCustomer.setText("Customer");
		btnMainCustomer.setFocusable(false);
		btnMainCustomer.setHorizontalTextPosition(SwingConstants.RIGHT);
		btnMainCustomer.setMaximumSize(new java.awt.Dimension(151, 57));
		btnMainCustomer.setMinimumSize(new java.awt.Dimension(151, 57));
		btnMainCustomer.setPreferredSize(new java.awt.Dimension(151, 57));
		btnMainCustomer.setVerifyInputWhenFocusTarget(false);

		btnMainProducts.setFont(new java.awt.Font("Calibri", 1, 18));
		btnMainProducts.setIcon(new ImageIcon("icon/products.png"));
		btnMainProducts.setText("Product");
		btnMainProducts.setFocusable(false);
		btnMainProducts.setHorizontalTextPosition(SwingConstants.RIGHT);

		btnMainInvoice.setFont(new java.awt.Font("Calibri", 1, 18));
		btnMainInvoice.setIcon(new ImageIcon("icon/invoice.png"));
		btnMainInvoice.setText("Invoice");
		btnMainInvoice.setFocusable(false);
		btnMainInvoice.setHorizontalTextPosition(SwingConstants.RIGHT);

		btnMainStatistic.setFont(new java.awt.Font("Calibri", 1, 18));
		btnMainStatistic.setIcon(new ImageIcon("icon/chart-icon.png"));
		btnMainStatistic.setText("Statistic");
		btnMainStatistic.setFocusable(false);
		btnMainStatistic.setHorizontalTextPosition(SwingConstants.RIGHT);
		btnMainStatistic.setPreferredSize(new java.awt.Dimension(120, 55));

		lblMainVersion.setFont(new java.awt.Font("Courier New", 0, 10));
		lblMainVersion.setText("Version 1.0.0");

		GroupLayout pn_main_mainmenuLayout = new GroupLayout(pnMainMenu);
		pnMainMenu.setLayout(pn_main_mainmenuLayout);
		pn_main_mainmenuLayout
				.setHorizontalGroup(pn_main_mainmenuLayout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								pn_main_mainmenuLayout
										.createSequentialGroup()
										.addContainerGap(
												GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)
										.addGroup(
												pn_main_mainmenuLayout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING)
														.addComponent(
																btnMainEmployee,
																GroupLayout.Alignment.TRAILING,
																GroupLayout.PREFERRED_SIZE,
																200,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnMainCustomer,
																GroupLayout.Alignment.TRAILING,
																GroupLayout.PREFERRED_SIZE,
																200,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnMainProducts,
																GroupLayout.Alignment.TRAILING,
																GroupLayout.PREFERRED_SIZE,
																200,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnMainInvoice,
																GroupLayout.Alignment.TRAILING,
																GroupLayout.PREFERRED_SIZE,
																200,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnMainStatistic,
																GroupLayout.Alignment.TRAILING,
																GroupLayout.PREFERRED_SIZE,
																200,
																GroupLayout.PREFERRED_SIZE))
										.addContainerGap())
						.addGroup(
								pn_main_mainmenuLayout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(lblMainVersion,
												GroupLayout.PREFERRED_SIZE, 87,
												GroupLayout.PREFERRED_SIZE)
										.addContainerGap(
												GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)));
		pn_main_mainmenuLayout
				.setVerticalGroup(pn_main_mainmenuLayout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								pn_main_mainmenuLayout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(btnMainEmployee,
												GroupLayout.PREFERRED_SIZE, 57,
												GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(btnMainCustomer,
												GroupLayout.PREFERRED_SIZE, 57,
												GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(btnMainProducts,
												GroupLayout.PREFERRED_SIZE, 57,
												GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(btnMainInvoice,
												GroupLayout.PREFERRED_SIZE, 57,
												GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(btnMainStatistic,
												GroupLayout.PREFERRED_SIZE, 57,
												GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED,
												164, Short.MAX_VALUE)
										.addComponent(lblMainVersion)));

		pnMainDisplay.setBackground(new java.awt.Color(255, 255, 255));

		GroupLayout pn_main_displaymenuLayout = new GroupLayout(pnMainDisplay);
		pnMainDisplay.setLayout(pn_main_displaymenuLayout);
		pn_main_displaymenuLayout.setHorizontalGroup(pn_main_displaymenuLayout
				.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0,
						903, Short.MAX_VALUE));
		pn_main_displaymenuLayout.setVerticalGroup(pn_main_displaymenuLayout
				.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0,
						0, Short.MAX_VALUE));

		pnMainLogininfor.setBackground(new java.awt.Color(255, 255, 255));

		btnMainChangepass.setFont(new java.awt.Font("Calibri", 1, 12));
		btnMainChangepass.setText("Change Information");

		lblMainUser.setFont(new java.awt.Font("Calibri", 1, 18));
		if (emp != null)
			lblMainUser.setText("Welcome: " + emp.getName());

		btnMainLogout.setFont(new java.awt.Font("Calibri", 1, 12));
		btnMainLogout.setText("Logout");

		MyDate m = new MyDate();
		String date = m.getDate();

		lblMainDate.setFont(new java.awt.Font("Calibri", 2, 18));
		lblMainDate.setText(date);

		GroupLayout pn_main_logininforLayout = new GroupLayout(pnMainLogininfor);
		pnMainLogininfor.setLayout(pn_main_logininforLayout);
		pn_main_logininforLayout
				.setHorizontalGroup(pn_main_logininforLayout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								pn_main_logininforLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												pn_main_logininforLayout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING)
														.addComponent(
																lblMainUser,
																GroupLayout.PREFERRED_SIZE,
																192,
																GroupLayout.PREFERRED_SIZE)
														.addGroup(
																pn_main_logininforLayout
																		.createSequentialGroup()
																		.addGroup(
																				pn_main_logininforLayout
																						.createParallelGroup(
																								GroupLayout.Alignment.TRAILING,
																								false)
																						.addComponent(
																								lblMainDate,
																								GroupLayout.DEFAULT_SIZE,
																								GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)
																						.addComponent(
																								btnMainChangepass,
																								GroupLayout.DEFAULT_SIZE,
																								127,
																								Short.MAX_VALUE))
																		.addPreferredGap(
																				LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				btnMainLogout,
																				GroupLayout.PREFERRED_SIZE,
																				65,
																				GroupLayout.PREFERRED_SIZE)))
										.addContainerGap(11, Short.MAX_VALUE)));
		pn_main_logininforLayout
				.setVerticalGroup(pn_main_logininforLayout
						.createParallelGroup(GroupLayout.Alignment.LEADING)
						.addGroup(
								GroupLayout.Alignment.TRAILING,
								pn_main_logininforLayout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(lblMainUser,
												GroupLayout.PREFERRED_SIZE, 23,
												GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.RELATED,
												GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)
										.addComponent(lblMainDate)
										.addPreferredGap(
												LayoutStyle.ComponentPlacement.UNRELATED)
										.addGroup(
												pn_main_logininforLayout
														.createParallelGroup(
																GroupLayout.Alignment.LEADING,
																false)
														.addComponent(
																btnMainChangepass,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE)
														.addComponent(
																btnMainLogout,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE))
										.addContainerGap()));

		GroupLayout layout = new GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout
				.createParallelGroup(GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										layout.createParallelGroup(
												GroupLayout.Alignment.LEADING)
												.addComponent(
														pnMainMenu,
														GroupLayout.PREFERRED_SIZE,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.PREFERRED_SIZE)
												.addComponent(
														pnMainLogininfor,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE))
								.addPreferredGap(
										LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(
												GroupLayout.Alignment.LEADING)
												.addComponent(
														pnMainTitle,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE)
												.addComponent(
														pnMainDisplay,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE))
								.addContainerGap()));
		layout.setVerticalGroup(layout
				.createParallelGroup(GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										layout.createParallelGroup(
												GroupLayout.Alignment.LEADING,
												false)
												.addComponent(
														pnMainLogininfor,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE)
												.addComponent(
														pnMainTitle,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE))
								.addPreferredGap(
										LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(
												GroupLayout.Alignment.LEADING)
												.addComponent(
														pnMainMenu,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE)
												.addComponent(
														pnMainDisplay,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE))
								.addContainerGap()));

		pack();

		pnMainDisplay.setMinimumSize(pnMainDisplay.getSize());
	}

	private void btn_main_employeeActionPerformed(java.awt.event.ActionEvent evt) {

	}

	 public static void main(String args[]) {
	 try {
	 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
	 Home.getInstance().setVisible(true);
	 } catch (Exception e) {
	 e.printStackTrace();
	 }
	 }

}
